package com.vlin.device.value.converter.condition;

import com.vlin.device.value.converter.AbstractConditionHandler;
import com.vlin.device.value.converter.Condition;
import com.vlin.device.value.converter.ParamValueConverter;
import com.vlin.device.value.converter.condition.utils.TuyaUtils;
import com.vlin.device.value.converter.defaut.DefaultParamValueConverter;
import com.vlin.entity.mode.DeviceMode;

public class TuyaConverterBuilder {

	
	
	public static ParamValueConverter getParamValueConverter() {
		
		ParamValueConverter converter = new DefaultParamValueConverter();
		converter.setDeviceMode(new DeviceMode(1, "TUYA"));
		
		TuyaCondition defIntCond = TuyaUtils.getIntegerCondition(new TuyaInteger("s", 0, 86400, 0, 1));
		TuyaCondition booCond = TuyaUtils.getBooleanCondition();
		converter .getConditionAndConverter().addConditionHandler(new TuyaBooleanHandler());
		converter .getConditionAndConverter().addConditionHandler(new TuyaIntegerHandler());
		converter .getConditionAndConverter().addConditionHandler(new TuyaEnumHandler());
		converter.setConverter("kg", "switch", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_1", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_2", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_3", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_4", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_5", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_6", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "countdown_1", defIntCond);
		converter.setConverter("kg", "countdown_2", defIntCond);
		converter.setConverter("kg", "countdown_3", defIntCond);
		converter.setConverter("kg", "countdown_4", defIntCond);
		converter.setConverter("kg", "countdown_5", defIntCond);
		converter.setConverter("kg", "countdown_6", defIntCond);
		converter.setConverter("kg", "switch_usb1", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_usb2", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_usb3", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_usb4", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_usb5", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "switch_usb6", TuyaUtils.getBooleanCondition());
		converter.setConverter("kg", "countdown_usb1", defIntCond);
		converter.setConverter("kg", "countdown_usb2", defIntCond);
		converter.setConverter("kg", "countdown_usb3", defIntCond);
		converter.setConverter("kg", "countdown_usb4", defIntCond);
		converter.setConverter("kg", "countdown_usb5", defIntCond);
		converter.setConverter("kg", "countdown_usb6", defIntCond);
		converter.setConverter("kg", "cur_current", TuyaUtils.getIntegerCondition(new TuyaInteger("mA", 0, 30000, 0, 1)));
		converter.setConverter("kg", "cur_power", TuyaUtils.getIntegerCondition(new TuyaInteger("W", 0, 50000, 0, 1)));
		converter.setConverter("kg", "cur_voltage", TuyaUtils.getIntegerCondition(new TuyaInteger("V", 0, 50000, -1, 1)));
		
		
		converter.setConverter("cz", "switch", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_1", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_2", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_3", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_4", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_5", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_6", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "countdown_1", defIntCond);
		converter.setConverter("cz", "countdown_2", defIntCond);
		converter.setConverter("cz", "countdown_3", defIntCond);
		converter.setConverter("cz", "countdown_4", defIntCond);
		converter.setConverter("cz", "countdown_5", defIntCond);
		converter.setConverter("cz", "countdown_6", defIntCond);
		converter.setConverter("cz", "switch_usb1", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_usb2", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_usb3", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_usb4", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_usb5", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "switch_usb6", TuyaUtils.getBooleanCondition());
		converter.setConverter("cz", "countdown_usb1", defIntCond);
		converter.setConverter("cz", "countdown_usb2", defIntCond);
		converter.setConverter("cz", "countdown_usb3", defIntCond);
		converter.setConverter("cz", "countdown_usb4", defIntCond);
		converter.setConverter("cz", "countdown_usb5", defIntCond);
		converter.setConverter("cz", "countdown_usb6", defIntCond);
		converter.setConverter("cz", "cur_current", TuyaUtils.getIntegerCondition(new TuyaInteger("mA", 0, 30000, 0, 1)));
		converter.setConverter("cz", "cur_power", TuyaUtils.getIntegerCondition(new TuyaInteger("W", 0, 50000, 0, 1)));
		converter.setConverter("cz", "cur_voltage", TuyaUtils.getIntegerCondition(new TuyaInteger("V", 0, 50000, -1, 1)));
		
		converter.setConverter("pc", "switch", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_1", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_2", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_3", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_4", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_5", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_6", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "countdown_1", defIntCond);
		converter.setConverter("pc", "countdown_2", defIntCond);
		converter.setConverter("pc", "countdown_3", defIntCond);
		converter.setConverter("pc", "countdown_4", defIntCond);
		converter.setConverter("pc", "countdown_5", defIntCond);
		converter.setConverter("pc", "countdown_6", defIntCond);
		converter.setConverter("pc", "switch_usb1", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_usb2", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_usb3", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_usb4", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_usb5", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "switch_usb6", TuyaUtils.getBooleanCondition());
		converter.setConverter("pc", "countdown_usb1", defIntCond);
		converter.setConverter("pc", "countdown_usb2", defIntCond);
		converter.setConverter("pc", "countdown_usb3", defIntCond);
		converter.setConverter("pc", "countdown_usb4", defIntCond);
		converter.setConverter("pc", "countdown_usb5", defIntCond);
		converter.setConverter("pc", "countdown_usb6", defIntCond);
		converter.setConverter("pc", "cur_current", TuyaUtils.getIntegerCondition(new TuyaInteger("mA", 0, 30000, 0, 1)));
		converter.setConverter("pc", "cur_power", TuyaUtils.getIntegerCondition(new TuyaInteger("W", 0, 50000, 0, 1)));
		converter.setConverter("pc", "cur_voltage", TuyaUtils.getIntegerCondition(new TuyaInteger("V", 0, 50000, -1, 1)));
		
		
		//converter.setConverter("cjkg", "cur_voltage", TuyaUtils.getIntegerCondition(new TuyaInteger("V", 0, 50000, -1, 1)));
		
		converter.setConverter("dj", "switch_led", booCond);
		converter.setConverter("dj", "work_mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("white","colour","scene","music","scene_1","scene_2","scene_3","scene_4")));
		converter.setConverter("dj", "bright_value", TuyaUtils.getIntegerCondition(new TuyaInteger("", 25, 255, 0, 1)));
		converter.setConverter("dj", "bright_value_v2", TuyaUtils.getIntegerCondition(new TuyaInteger("", 10, 1000, 0, 1)));
		converter.setConverter("dj", "temp_value", TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 255, 0, 1)));
		converter.setConverter("dj", "temp_value_v2", TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 1000, 0, 1)));
		converter.setConverter("dj", "colour_data", booCond);
		converter.setConverter("dj", "colour_data_v2", booCond);
		converter.setConverter("dj", "scene_data", booCond);
		converter.setConverter("dj", "scene_data_v2", booCond);
		converter.setConverter("dj", "flash_scene_1", booCond);
		converter.setConverter("dj", "flash_scene_2", booCond);
		converter.setConverter("dj", "flash_scene_3", booCond);
		converter.setConverter("dj", "flash_scene_4", booCond);
		converter.setConverter("dj", "music_data", booCond);
		converter.setConverter("dj", "control_data", booCond);
		converter.setConverter("dj", "countdown_1", booCond);
		converter.setConverter("dj", "scene_select", booCond);
		converter.setConverter("dj", "switch_health_read", booCond);
		converter.setConverter("dj", "read_time", booCond);
		converter.setConverter("dj", "rest_time", booCond);
		
		
		converter.setConverter("clkg", "control", 
				TuyaUtils.getEnumCondition(new TuyaEnum("open","stop","close")));
		converter.setConverter("clkg", "control_2", 
				TuyaUtils.getEnumCondition(new TuyaEnum("open","stop","close")));
		converter.setConverter("clkg", "control_back", 
				booCond);
		converter.setConverter("clkg", "percent_control", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 10)));
		converter.setConverter("clkg", "percent_control_2", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 10)));
		converter.setConverter("clkg", "cur_calibration", 
				TuyaUtils.getEnumCondition(new TuyaEnum("start","end")));
		converter.setConverter("clkg", "cur_calibration_2", 
				TuyaUtils.getEnumCondition(new TuyaEnum("start","end")));
		converter.setConverter("clkg", "tr_timecon", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("s", 10, 120, 0, 1)));
		
		
		
		converter.setConverter("ktkzq", "switch", 
				booCond);
		converter.setConverter("ktkzq", "temp_set", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℃", 0, 40, 0, 1)));
		converter.setConverter("ktkzq", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("hot","cold","wet","wind")));
		converter.setConverter("ktkzq", "windspeed", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2","3","4","5","6")));
		
		converter.setConverter("bh", "switch", 
				booCond);
		converter.setConverter("bh", "boil_temp_set", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2","3","4")));
		converter.setConverter("bh", "cool_temp_set", 
				TuyaUtils.getEnumCondition(new TuyaEnum("0","1","2","3")));
		converter.setConverter("bh", "keep_temp", 
				booCond);
		converter.setConverter("bh", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("quick","manual","smart")));
		
		
		converter.setConverter("sd", "power", 
				booCond);
		converter.setConverter("sd", "power_go", 
				booCond);
		converter.setConverter("sd", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("standby","random","smart",
						"wall_follow","mop","spiral","left_spiral","right_spiral","right_bow","left_bow","partial_bow","chargego")));
		converter.setConverter("sd", "direction_control", 
				TuyaUtils.getEnumCondition(new TuyaEnum("forward","backward","turn_left","turn_right","stop")));
		converter.setConverter("sd", "suction", 
				TuyaUtils.getEnumCondition(new TuyaEnum("strong","normal")));
		converter.setConverter("sd", "reset_edge_brush", 
				booCond);
		converter.setConverter("sd", "reset_roll_brush", 
				booCond);
		converter.setConverter("sd", "reset_filter", 
				booCond);
		converter.setConverter("sd", "seek", 
				booCond);
		converter.setConverter("sd", "status", 
				TuyaUtils.getEnumCondition(new TuyaEnum("0","1","2","3","4","5","6")));
		converter.setConverter("sd", "electricity_left", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("sd", "clean_area", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("㎡", 0, 9999, 0, 1)));
		converter.setConverter("sd", "clean_time", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("minute", 0, 9999, 0, 1)));
		converter.setConverter("sd", "edge_brush", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("sd", "roll_brush", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("sd", "filter", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		
		
		converter.setConverter("xxj", "switch", 
				booCond);
		converter.setConverter("xxj", "switch_spray", 
				booCond);
		converter.setConverter("xxj", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("large","middle","small","interval","continuous")));
		converter.setConverter("xxj", "countdown", 
				TuyaUtils.getEnumCondition(new TuyaEnum("cancel","1","2","3","4","5","6")));
		converter.setConverter("xxj", "moodlighting", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2","3","4","5")));
		converter.setConverter("xxj", "switch_led", 
				booCond);
		converter.setConverter("xxj", "work_mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("white","colour","colourful1")));
		converter.setConverter("xxj", "colour_data", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 255, 0, 1)));
		/*
		 * converter.setConverter("xxj", "colour_data_hsv", booCond);
		 */
		converter.setConverter("xxj", "bright_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 255, 0, 1)));
		converter.setConverter("xxj", "bright_value_v2", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 10, 1000, 0, 1)));
		converter.setConverter("xxj", "switch_sound", 
				booCond);
		
		
		converter.setConverter("jsq", "switch", 
				booCond);
		converter.setConverter("jsq", "switch_spray", 
				booCond);
		converter.setConverter("jsq", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("large","middle","small","interval","continuous")));
		converter.setConverter("jsq", "spray_mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("auto","health","baby","sleep","humidity")));
		converter.setConverter("jsq", "countdown", 
				TuyaUtils.getEnumCondition(new TuyaEnum("cancel","1","2","3","4","5","6")));
		converter.setConverter("jsq", "moodlighting", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2","3","4","5")));
		converter.setConverter("jsq", "switch_led", 
				booCond);
		converter.setConverter("jsq", "work_mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("white","colour","colorful1")));
		converter.setConverter("jsq", "colour_data", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 255, 0, 1)));
		/*
		 * converter.setConverter("jsq", "colour_data_hsv", booCond);
		 */
		converter.setConverter("jsq", "bright_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 255, 0, 1)));
		converter.setConverter("jsq", "bright_value_v2", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 10, 1000, 0, 1)));
		converter.setConverter("jsq", "switch_sound", 
				booCond);
		converter.setConverter("jsq", "spray_mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("auto","health","baby","sleep","humidity")));
		converter.setConverter("jsq", "temp_set", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℃", 0, 50, 0, 1)));
		converter.setConverter("jsq", "temp_set_f", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℉", 0, 100, 0, 1)));
		converter.setConverter("jsq", "humidity_set", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("jsq", "sleep", 
				booCond);
		converter.setConverter("jsq", "c_f", 
				TuyaUtils.getEnumCondition(new TuyaEnum("C","F")));
		converter.setConverter("jsq", "sterilization", 
				booCond);
				
		
		
		converter.setConverter("kt", "switch", 
				booCond);
		converter.setConverter("kt", "temp_set", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℃", 0, 50, 0, 1)));
		converter.setConverter("kt", "temp_set_f", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℉", 0, 100, 0, 1)));
		converter.setConverter("kt", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("auto","cold","hot","wet","wind")));
		converter.setConverter("kt", "windspeed", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2","3","4","5","6")));
		converter.setConverter("kt", "fan_speed_enum", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","mid","high","auto")));
		converter.setConverter("kt", "mode_auto", 
				booCond);
		converter.setConverter("kt", "mode_eco", 
				booCond);
		converter.setConverter("kt", "mode_dry", 
				booCond);
		converter.setConverter("kt", "mode_ventilation", 
				booCond);
		converter.setConverter("kt", "anion", 
				booCond);
		converter.setConverter("kt", "heat", 
				booCond);
		converter.setConverter("kt", "light", 
				booCond);
		converter.setConverter("kt", "lock", 
				booCond);
		converter.setConverter("kt", "windshake", 
				TuyaUtils.getEnumCondition(new TuyaEnum("horizontal","vertical")));
		converter.setConverter("kt", "beep", 
				booCond);
		converter.setConverter("kt", "humidity_set", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("kt", "c_f", 
				TuyaUtils.getEnumCondition(new TuyaEnum("C","F")));
		converter.setConverter("kt", "countdown", 
				TuyaUtils.getEnumCondition(new TuyaEnum("cancel","1","2","3","4","5","6")));
		
		
		converter.setConverter("kj", "switch", 
				booCond);
		converter.setConverter("kj", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("auto","sleep","manual","pollen","comfortable")));
		converter.setConverter("kj", "speed", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2","3","4","5","6")));
		converter.setConverter("kj", "fan_speed_enum", 
				TuyaUtils.getEnumCondition(new TuyaEnum("sleep","low","mid","high","auto")));
		converter.setConverter("kj", "anion", 
				booCond);
		converter.setConverter("kj", "lock", 
				booCond);
		converter.setConverter("kj", "light", 
				booCond);
		converter.setConverter("kj", "uv", 
				booCond);
		converter.setConverter("kj", "wet", 
				booCond);
		converter.setConverter("kj", "filter_reset", 
				booCond);
		converter.setConverter("kj", "countdown", 
				TuyaUtils.getEnumCondition(new TuyaEnum("cancel","1","2","3","4","5","6")));
		
		
		converter.setConverter("lyj", "control", 
				TuyaUtils.getEnumCondition(new TuyaEnum("up","down","stop")));
		converter.setConverter("lyj", "light", 
				booCond);
		converter.setConverter("lyj", "disinfection", 
				booCond);
		converter.setConverter("lyj", "wind_dry", 
				booCond);
		converter.setConverter("lyj", "hot_dry", 
				booCond);
		converter.setConverter("lyj", "position", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("lyj", "anion", 
				booCond);
		
		
		converter.setConverter("qn", "tmp_set", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("°C", 0, 40, 0, 1)));
		converter.setConverter("qn", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("smart","auto")));
		converter.setConverter("qn", "level", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2","3")));
		converter.setConverter("qn", "mode_eco", 
				booCond);
		converter.setConverter("qn", "lock", 
				booCond);
		converter.setConverter("qn", "shake", 
				booCond);
		converter.setConverter("qn", "anion", 
				booCond);
		converter.setConverter("qn", "light", 
				booCond);
		converter.setConverter("qn", "countdown", 
				TuyaUtils.getEnumCondition(new TuyaEnum("cancel","1","2","3","4","5","6")));
		converter.setConverter("qn", "c_f", 
				TuyaUtils.getEnumCondition(new TuyaEnum("C","F")));
		
		
		converter.setConverter("cl", "control", 
				TuyaUtils.getEnumCondition(new TuyaEnum("open","stop","close")));
		converter.setConverter("cl", "percent_control", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%",0,100,0,1)));
		converter.setConverter("cl", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("morning","night")));
		converter.setConverter("cl", "control_back", 
				booCond);
		converter.setConverter("cl", "auto_power", 
				booCond);
		converter.setConverter("cl", "countdown", 
				TuyaUtils.getEnumCondition(new TuyaEnum("cancel","1","2","3","4","5","6")));
		
		
		converter.setConverter("wk", "switch", 
				booCond);
		converter.setConverter("wk", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("cold","hot","wind")));
		converter.setConverter("wk", "eco", 
				booCond);
		converter.setConverter("wk", "anion", 
				booCond);
		converter.setConverter("wk", "light", 
				booCond);
		converter.setConverter("wk", "sound", 
				booCond);
		converter.setConverter("wk", "window_check", 
				booCond);
		converter.setConverter("wk", "sleep", 
				booCond);
		converter.setConverter("wk", "frost", 
				booCond);
		converter.setConverter("wk", "valve_check", 
				booCond);
		converter.setConverter("wk", "switch_vertical", 
				booCond);
		converter.setConverter("wk", "switch_horizontal", 
				booCond);
		converter.setConverter("wk", "fan_horizontal", 
				TuyaUtils.getEnumCondition(new TuyaEnum("30","90")));
		converter.setConverter("wk", "fan_vertical", 
				TuyaUtils.getEnumCondition(new TuyaEnum("30","90")));
		converter.setConverter("wk", "temp_set", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℃", 5, 40, 0, 1)));
		converter.setConverter("wk", "temp_set_f", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℉", 32, 104, 0, 1)));
		converter.setConverter("wk", "upper_temp_f", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℉", 70, 104, 0, 1)));
		converter.setConverter("wk", "upper_temp", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℃", 20, 40, 0, 1)));
		converter.setConverter("wk", "lower_temp_f", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℉", 32, 70, 0, 1)));
		converter.setConverter("wk", "capacity_set", 
				TuyaUtils.getEnumCondition(new TuyaEnum("2000W","3000W","5000W")));
		converter.setConverter("wk", "c_f", 
				TuyaUtils.getEnumCondition(new TuyaEnum("C","F")));
		converter.setConverter("wk", "lower_temp", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℃", 0, 20, 0, 1)));
		converter.setConverter("wk", "temp_correction", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", -9, 9, 0, 1)));
		converter.setConverter("wk", "level", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high","auto")));
		converter.setConverter("wk", "work_days", 
				TuyaUtils.getEnumCondition(new TuyaEnum("5_2","6_1","7")));
		converter.setConverter("wk", "holiday_temp_set", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℃", 0, 40, 0, 1)));
		converter.setConverter("wk", "holiday_days_set", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("day", 0, 99, 0, 1)));
		converter.setConverter("wk", "child_lock", 
				booCond);
		converter.setConverter("wk", "countdown", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1h","2h","3h","4h","5h","6h","7h","8h","9h","10h","11h","12h","13h","14h","15h","16h","17h","18h","19h","20h","21h","22h","23h","24h")));
		converter.setConverter("wk", "sensor_choose", 
				TuyaUtils.getEnumCondition(new TuyaEnum("in","out")));
		converter.setConverter("wk", "backlight", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		
		
		
		
		converter.setConverter("fs", "switch", 
				booCond);
		converter.setConverter("fs", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("nature","sleep","fresh","smart")));
		converter.setConverter("fs", "fan_speed", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2","3","4")));
		converter.setConverter("fs", "fan_speed_percent", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 1, 100, 0, 1)));
		converter.setConverter("fs", "switch_vertical", 
				booCond);
		converter.setConverter("fs", "switch_horizontal", 
				booCond);
		converter.setConverter("fs", "fan_vertical", 
				TuyaUtils.getEnumCondition(new TuyaEnum("30","60","90")));
		converter.setConverter("fs", "fan_horizontal", 
				TuyaUtils.getEnumCondition(new TuyaEnum("30","60","90")));
		converter.setConverter("fs", "fan_direction", 
				TuyaUtils.getEnumCondition(new TuyaEnum("forward","reverse")));
		converter.setConverter("fs", "anion", 
				booCond);
		converter.setConverter("fs", "humidifier", 
				booCond);
		converter.setConverter("fs", "oxygen", 
				booCond);
		converter.setConverter("fs", "fan_cool", 
				booCond);
		converter.setConverter("fs", "fan_beep", 
				booCond);
		converter.setConverter("fs", "child_lock", 
				booCond);
		converter.setConverter("fs", "light", 
				booCond);
		converter.setConverter("fs", "bright_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 10, 1000, 0, 1)));
		converter.setConverter("fs", "temp_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 10, 1000, 0, 1)));
		converter.setConverter("fs", "colour_data", 
				booCond);
		converter.setConverter("fs", "work_mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("white","colour","colourful")));
		converter.setConverter("fs", "temp", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℃", 0, 50, 0, 1)));
		converter.setConverter("fs", "countdown", 
				TuyaUtils.getEnumCondition(new TuyaEnum("0","1","2","3","4","5","6")));
		converter.setConverter("fs", "temp_current", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("℃", 0, 50, 0, 1)));
		converter.setConverter("fs", "countdown_left", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("min", 0, 360, 0, 1)));
		
		
		
		converter.setConverter("mcs", "doorcontact_state", 
				booCond);
		converter.setConverter("mcs", "switch", 
				booCond);
		converter.setConverter("mcs", "temper_alarm", 
				booCond);
		converter.setConverter("mcs", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("mcs", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("mcs", "battery", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("mcs", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		
		converter.setConverter("sj", "watersensor_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2")));
		converter.setConverter("sj", "temper_alarm", 
				booCond);
		converter.setConverter("sj", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("sj", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("sj", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		
		
		converter.setConverter("wsdcg", "va_temperature", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 1000, 1, 1)));
		converter.setConverter("wsdcg", "va_humidity", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 1000, 1, 1)));
		converter.setConverter("wsdcg", "temper_alarm", 
				booCond);
		converter.setConverter("wsdcg", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("wsdcg", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("wsdcg", "va_battery", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("wsdcg", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		
		converter.setConverter("pir", "pir", 
				TuyaUtils.getEnumCondition(new TuyaEnum("pir","none")));
		converter.setConverter("pir", "temper_alarm", 
				booCond);
		converter.setConverter("pir", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("pir", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("pir", "battery", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("pir", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		
		converter.setConverter("zd", "pressure_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("normal","vibration","drop","tilt")));
		converter.setConverter("zd", "temper_alarm", 
				booCond);
		converter.setConverter("zd", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("zd", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("zd", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		
		converter.setConverter("ylcg", "pressure_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2")));
		converter.setConverter("ylcg", "temper_alarm", 
				booCond);
		converter.setConverter("ylcg", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("ylcg", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("ylcg", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		converter.setConverter("ldcg", "bright_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		converter.setConverter("ldcg", "co2_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 1000, 1, 1)));
		converter.setConverter("ldcg", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("ldcg", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("ldcg", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		
		converter.setConverter("ywbj", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("ywbj", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("ywbj", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		converter.setConverter("ywbj", "smoke_sensor_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 1000, 1, 1)));
		converter.setConverter("ywbj", "smoke_sensor_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2")));
		
		
		converter.setConverter("sgbj", "alarm_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2","3","4")));
		converter.setConverter("sgbj", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("sgbj", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("sgbj", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		converter.setConverter("co2bj", "co2_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 1000, 1, 1)));
		converter.setConverter("co2bj", "co2_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2")));
		converter.setConverter("co2bj", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("co2bj", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("co2bj", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		
		converter.setConverter("cobj", "co_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 1000, 1, 1)));
		converter.setConverter("cobj", "co_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2")));
		converter.setConverter("cobj", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("cobj", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("cobj", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		
		converter.setConverter("pm2.5", "pm25", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 999, 0, 1)));
		converter.setConverter("pm2.5", "pm25_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2")));
		converter.setConverter("pm2.5", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("pm2.5", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("pm2.5", "battery_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		
		converter.setConverter("rqbj", "gas_sensor_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 1000, 1, 1)));
		converter.setConverter("rqbj", "gas_sensor_state", 
				TuyaUtils.getEnumCondition(new TuyaEnum("1","2")));
		converter.setConverter("rqbj", "battery_percentage", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("rqbj", "battery_value", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("", 0, 30000, 0, 1)));
		converter.setConverter("rqbj", "battery_state",
				TuyaUtils.getEnumCondition(new TuyaEnum("low","middle","high")));
		
		
		converter.setConverter("sf", "switch", booCond);
		converter.setConverter("sf", "mode", 
				TuyaUtils.getEnumCondition(new TuyaEnum("reading","music","tv","lying","sitting","movie")));
		converter.setConverter("sf", "stop", booCond);
		converter.setConverter("sf", "head_run", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("sf", "whole_run", 
				TuyaUtils.getIntegerCondition(new TuyaInteger("%", 0, 100, 0, 1)));
		converter.setConverter("sf", "child_lock", booCond);
		converter.setConverter("sf", "lie_low", booCond);
		
		return converter;
	}
	
	
	
	public static class TuyaBooleanHandler extends AbstractConditionHandler {

		@Override
		public boolean supportCondition(Condition condition) {
			
			return Boolean.class.equals(condition.convertClass()) && TuyaCondition.class.isAssignableFrom(condition.getClass());
		}

		@Override 
		public boolean outOfRange(Object value, Condition condition) {
			return false;
		}
		
	}
	
	public static class TuyaIntegerHandler extends AbstractConditionHandler {

		@Override
		public boolean supportCondition(Condition condition) {
			return Boolean.class.equals(condition.convertClass()) && TuyaIntegerCondition.class.isAssignableFrom(condition.getClass());
		}

		@Override
		public boolean outOfRange(Object value, Condition condition) {
			Integer v = (Integer) value;
			TuyaIntegerCondition cond = (TuyaIntegerCondition) condition;
			TuyaInteger tuyaInt = cond.getTuyaInteger();
			int begin = tuyaInt.getMin();
			int end = tuyaInt.getMax();
			if(v >= begin && v <= end) {
				return false;
			}
			return true;
		}
		
	}
	
	public static class TuyaEnumHandler extends AbstractConditionHandler {

		@Override
		public boolean supportCondition(Condition condition) {

			return String.class.equals(condition.convertClass()) && TuyaEnumCondition.class.isAssignableFrom(condition.getClass());
		}

		@Override
		public boolean outOfRange(Object value, Condition condition) {

			String v = (String) value;
			TuyaEnumCondition cond = (TuyaEnumCondition) condition;
			
			if(cond.getTuyaEnum().support(v))
				return false;
			return true;
		}		
		
	}
}
